#include <iostream>
#include <deque>

using std::cout;
using std::endl;
using std::deque;


template <typename Container>
void display(const Container &con)
{
    for(auto &elem : con)
    {
        cout << elem << "  ";
    }
    cout << endl;
}

void test()
{
    deque<int> number = {1, 3, 5, 7, 9, 8, 6, 4, 2, 10};
    display(number);

    cout << endl << "在deque的尾部进行插入与删除" << endl;
    number.push_back(100);
    number.push_back(200);
    display(number);
    number.pop_back();
    display(number);

    cout << endl << "在deque的头部进行插入与删除" << endl;
    number.push_front(111);
    number.push_front(222);
    display(number);
    number.pop_front();
    display(number);
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

